import requests
import gzip

def get_user_info(url):
    session = requests.Session()
    session.headers.update({
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
        "Accept-Encoding": "gzip, deflate",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "max-age=0",
        "Upgrade-Insecure-Requests": "1"
    })
    res = session.get(url)
    if res.headers.get("Content-Encoding") == "gzip":
        return gzip.decompress(res.content).decode()
    else:
        return res.text

if __name__=="__main__":
    url = """http://10.12.129.100:7102/UAC/LoginPageServlet?_dc=1701743929157&method=Login&inputId=ericzhang&password=Key%40741852963&domain=&successPage"""
    res = get_user_info(url)
    print(res)
